package com.web.kdl.controller.alert;

import com.web.kdl.common.result.CommonResult;
import com.web.kdl.daoV2.siteWheel.SiteWheelDao;
import com.web.kdl.entity.alert.Alert;
import com.web.kdl.entity.sitewheel.SiteWheel;
import com.web.kdl.pojo.form.AlertForm;
import com.web.kdl.service.alsert.AlertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Author： shulibin
 * @Date： 2025/7/21 10:23
 * @Describe：
 */
@Controller
public class alertController {


    @Autowired
    private AlertService alertService;
    //获取一个时间节点的所有飞轮的数据报警信息
    @PostMapping("/getAllAlerts")
    @ResponseBody
    public CommonResult<List<Alert>> getAllAlerts(){
        List<Alert> Alerts = alertService.getAllAlertData();
        return CommonResult.success(Alerts);
    }

    //获取查询的一个设备的数据信息
    @PostMapping("/getAlertData")
    @ResponseBody
    public CommonResult<List<Map<String, Object>>> getDataReport(@RequestBody AlertForm alertForm){
        List<Map<String, Object>> Alert = alertService.getAlertData(alertForm);
        return CommonResult.success(Alert);
    }


}
